var app = getApp();
var Const = require('./../../utils/const.js');
const Zan = require('../../dist/index');

Page(Object.assign({}, Zan.TopTips, {
	data: {
		pageNum: 1,
		pageSize: 20,
		networkList: []
	},

	onLoad: function () {
		this._getNetWorkList();
	},

	_getNetWorkList: function() {
		let that = this;
		app.battery.common('network/list2', {
			pageNum: that.data.pageNum,
			pageSize: that.data.pageSize
		}).then(function (d) {
			that.setData({
				networkList: d.list
			})
		}).catch(function (e) {
			that.showZanTopTips(e.message, {type: 'error'});
		});
	},

	onTapNavi: function(e) {
		let item = e.currentTarget.dataset.item;
		wx.openLocation({
			latitude: Number(item.gpsLat),
			longitude: Number(item.gpsLng),
			name: item.name,
			scale: 28
		})
	},

	makePhoneCall: function (e) {
		let phone = e.currentTarget.dataset.phone;
		wx.makePhoneCall({
			phoneNumber: phone
		})
	}
}));
